package com.yizhang.xml.aop;

import org.aspectj.lang.ProceedingJoinPoint;

/**
 * @Author: yi.zhang
 * @CreateTime: 2025-06-11 10:33:41
 * @Description: 通知类
 */
public class MyAdvice {

    public void before() {
        System.out.println("前置通知====================");
    }

    public void afterReturning() {
        System.out.println("后置通知====================");
    }

    public Object around(ProceedingJoinPoint joinPoint) throws Throwable {
        System.out.println("环绕前通知====================");
        Object result = joinPoint.proceed();
        System.out.println("环绕后通知====================");
        return result;
    }

    public void afterThrowing(Throwable e) {
        System.out.println("异常通知====================");
        System.out.println("异常：" + e.getMessage());
    }

    public void after() {
        System.out.println("最终通知====================");
    }
}
